<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
</head>

<body>

	<?php

//纯PHP页面的中文乱码问题（数据是静态的）
header("Content-Type: text/html; charset: utf-8");

//PHP+Mysql中文乱码问题
mysql_query('SET NAMES UTF8');

$conn = odbc_connect('northwind', '', '');
if(!$conn) {
    exit("连接失败:". $conn);
}

$sql = "SELECT * FROM customers";
$rs = odbc_exec($conn, $sql);

if(!$rs) {
    exit("SQL 语句错误");
}

echo "<table><tr><th>CompanyName</th><th>ContantName</th></tr>";
while(odbc_fetch_row($rs)) {
    $companyname = odbc_result($rs, "CompanyName");
    $conname = odbc_result($rs, "ContactName");
    echo "<tr><td>$companyname</td>";
    echo "<td>$conname</td></tr>";
}

odbc_close($conn);
echo "</table>";

?>

</body>

</html>